package com.gitee.wsl.ext.number

private val DECIMAL = 10

/**
 * Reverses the digits of a Long number.
 *
 * @return The reversed Long number.
 */
fun Long.reverse(): Long {
    var reversedNumber = 0L
    var currentNumber = this
    while (currentNumber > 0) {
        reversedNumber = DECIMAL * reversedNumber + currentNumber % DECIMAL
        currentNumber /= DECIMAL
    }
    return reversedNumber
}

